<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>请假申请</title>
   <link rel="stylesheet" type="text/css" href="themes/metro/easyui.css">  
    <link rel="stylesheet" type="text/css" href="themes/mobile.css">  
    <link rel="stylesheet" type="text/css" href="themes/icon.css">  
    <script type="text/javascript" src="js/jquery.min.js"></script>  
    <script type="text/javascript" src="js/jquery.easyui.min.js"></script> 
    <script type="text/javascript" src="js/jquery.easyui.mobile.js"></script> 
   <script type="text/javascript" src="${pageContext.request.contextPath}/js/easyui-lang-zh_CN.js"></script>
</head>
<script type="text/javascript">
 $(function(){
	 $('#tb').textbox({       
		    iconAlign:'left'       
		}),
		$('#tb1').textbox({       
		    iconAlign:'left'       
		}),
		$('#tb2').textbox({       
		    iconAlign:'left'       
		}),
		$('#tb3').textbox({       
		    iconAlign:'left'       
		}),
		$('#tb4').textbox({       
		    iconAlign:'left'       
		}),
		$('#tb5').textbox({       
		    iconAlign:'left'       
		}),
		$('#tb6').textbox({       
		    iconAlign:'left'       
		}),
		$('#tb7').textbox({       
		    iconAlign:'left'       
		}),
		$('#win').window({
		    width:800,    
		    height:500,    
		    title:"请填写请假信息",
			collapsible : false,//关闭折叠按钮
			closable : true,//x按钮
			minimizable : false   
		}); 
	 $('#btn').bind('click', function(){    
			//配置form表单提交
			$('#tjsq').form({    
			    url:'tjsq',
			    onSubmit: function(){     
			    	//阻止表单提交 
					return $(this).form('enableValidation').form('validate');
			    },    
			    success:function(data){  
			    	if(data==0){
			    		$("#btn").linkbutton({
			        		onClick:function(){
			        		disabled=true;
			        		}
			       });
			    		$.messager.alert('提示', '今天已经提交过');
			    	}else{
			    		  if(data==1){
					        	$.messager.alert('提示', '申请成功');
					        }else{
					        	$.messager.show({
					        		title:'信息提示',
					        		msg:'提交失败',
					        		timeout:1000,
					        		showType:'slide'
					        	})
					        }
			    	}
			    }    
			});
			 $('#tjsq').submit();
	    });
	
		$('#tb6').textbox('readonly',true);
		
	//查看申请记录
	$("#d").hide()
	 $("#cktj").linkbutton({
		   
		     onClick:function(){
		    	 $("#win").window("close");
		    	 $('#ckou').window({
		 		    width:800,    
		 		    height:500,    
		 		    title:"查看申请记录",
		 			collapsible : false,//关闭折叠按钮
					closable : true,//x按钮
					minimizable : false   
		 		});
		    	
		    	 $('#ckou').datagrid({ 
		    //显示申请信息
		    		    url:'cktj',    
		    		    columns:[[
		    		        {field:'ck',width:100,checkbox:true},
		    		        {field:'ename',title:'申请人',width:100},
		    		        {field:'actualday',title:'请假天数',width:100} ,
		    		        {field:'category',title:'请假类别',width:100},    
		    		        {field:'reason',title:'请假事由',width:100},    
		    		        {field:'opinion',title:'人事审核意见',width:100} ,
		    		        {field:'remake',title:'备注',width:100}, 
		    		    ]],
		    		    
		    			pagePosition : 'bottom',
		    			pagination : true,
		    			fitColumns:true,
		    			
		    			pageSize : 6,
		    			pageList : [ 6, 12,18 ],
		    	
		    	 })
		    	  $("#d").show();
		     }
	 })
	 $.extend($.fn.validatebox.defaults.rules, {    
		 actualday: {// value值为文本框中的值
                validator : function(value) {
                    var reg = /^[0-9]*$/ ;
                    return reg.test(value);
                },
                message : '请输入数字'
            },
	 })
	
 })
</script>

<body>
<div id="ckou"></div>
   
<div id="win"> 
<form id="tjsq" method="post">
<div id="sqnr" style="margin-top:30px;font-weight: bold;margin-left:70px;line-height:60px">
<div id="div1" style="margin-left: 38px">
<label>申请人:</label><input id='tb' name='eid'  class="easyui-textbox" type="text" style="width: 200px" value="${sessionScope.user.username}"/>

<label>请假申请日期:</label><input id="tb1" name="edata" type="text" class="easyui-datetimebox" style="width: 200px" data-options="required:true,validType:'edata'"/>
</div>
<div id="div2">
<label>请假开始日期:</label><input id="tb2" name="etartday" class="easyui-datetimebox" style="width:200px" type="text" data-options="required:true,validType:'etartday'"/>
<label>&nbsp;&nbsp;请假天数:</label><input id="tb3" name="actualday" type="text" style="width:200px" data-options="required:true,validType:'actualday'"/>
</div>

<div id="div3" style="margin-left:26px">
<label>请假类别:</label><select id="tb4" name="category" class="easyui-combobox" style="width:200px;" data-options="panelHeight:'auto',editable:false">
             <option value="病假">病假</option>   
				<option>年假</option>
				<option>事假</option>   
				<option>其它</option>         
			</select> 
<label>&nbsp;&nbsp;请假事由:</label><input id="tb5" name="reason" type="text" style="width:200px" data-options="required:true,validType:'reason'"/>
</div>
   <div id="div4" style="margin-left:-14px">
<label>人事部签核意见:</label><input id="tb6" name="opinion" type="text" style="width:200px">
<label>&nbsp;&nbsp;&nbsp;&nbsp;备注:</label><input id="tb7" name="remake" type="text" style="width:200px">

  </div>
    <div id="div5" style="margin-left: 230px">
  <a id="btn" href="#" class="easyui-linkbutton" style="margin-left: 20px;">提交申请</a>
  <input type="reset" name="cz" value="重置申请" class="easyui-linkbutton" >
   <br>
   <a id="cktj" href="#" class="easyui-linkbutton" style="margin-left: 20px;">查看已提交的申请</a>
   
    </div>

</div>
</form>
</div>

  
</body>
</html>